﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AMAP.ServiceInterfaces;
using System.Web.Mvc;

namespace AMAP.RoleProvider
{
    public class CustomRoleProvider : System.Web.Security.RoleProvider
    {
        private IAuthenticationService AuthenticationService;

        public CustomRoleProvider()
            : base()
        {
            AuthenticationService = DependencyResolver.Current.GetService<IAuthenticationService>();
        }


        public override void AddUsersToRoles(string[] usernames, string[] roleNames)
        {
            throw new NotImplementedException();
        }

        public override string ApplicationName
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public override void CreateRole(string roleName)
        {
            throw new NotImplementedException();
        }

        public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
        {
            throw new NotImplementedException();
        }

        public override string[] FindUsersInRole(string roleName, string usernameToMatch)
        {
            throw new NotImplementedException();
        }

        public override string[] GetAllRoles()
        {
            return AuthenticationService.GetAllRoles();
            //throw new NotImplementedException();
        }

        public override string[] GetRolesForUser(string userName)
        {
            return AuthenticationService.GetUserRoles(userName);
        }

        public override string[] GetUsersInRole(string roleName)
        {
            throw new NotImplementedException();
        }

        public override bool IsUserInRole(string userName, string roleName)
        {
            return AuthenticationService.IsUserInRole(userName, roleName);
        }

        public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames)
        {
            throw new NotImplementedException();
        }

        public override bool RoleExists(string roleName)
        {
            throw new NotImplementedException();
        }
    }
}